home *** CD-ROM | disk | FTP | other *** search
- /*
- File: GXPrintingUniverse.h
-
- Contains: QuickDraw GX to PostScript conversion code.
- definitions
-
- This file includes definitions necessary for the GX->PostScript library.
-
- Since these types came from the GX public headers
- Documentation for these types and structures are available in "Inside Mac: GX Printing" and
- "Inside Mac: GX Printing Extensions and Drivers"
-
- Version: Technology: Quickdraw GX 1.1.x
-
- Copyright: © 1994-1997 by Apple Computer, Inc., all rights reserved.
- */
-
- #ifndef __GXPRINTINGUNIVERSE__
- #define __GXPRINTINGUNIVERSE__
-
- #include <GXFonts.h>
- #include <GXGraphics.h>
- #include "GXToPSBuildConfig.h"
- #include <CMApplication.h>
-
- typedef void* TFile; // temp, until I get to this DL 7/26/87
-
- #define printingBaseID -27000
-
- /* Options for gxBufferData message */
-
- enum {
- gxNoBufferOptions = 0x00000000,
- gxMakeBufferHex = 0x00000001,
- gxDontSplitBuffer = 0x00000002
- };
-
-
- #define kScriptResType FOUR_CHAR_CODE('STR#')
-
-
- enum {
- gxPrintingResultBase = -510 /*First QuickDraw GX printing error code.*/
- };
-
- /*RESULT CODES FOR QUICKDRAW GX PRINTING OPERATIONS*/
-
- enum {
- gxPrUserAbortErr = (gxPrintingResultBase - 26), /*-536 : User aborted*/
- gxIncompletePrintFileErr = (gxPrintingResultBase - 35), /*-545 : Print file was not completely spooled*/
- gxNotEnoughPrinterMemory = (gxPrintingResultBase - 45), /*-555 : Printer does not have enough memory for fonts in document*/
- };
-
-
-
- /* ------------------------------------------------------------------------------
-
- PostScript Driver Contants and Types
-
- -------------------------------------------------------------------------------- */
-
- enum {
- gxPostSynonym = FOUR_CHAR_CODE('post')
- };
-
- /* PostScript glyphs record */
- struct gxPrinterGlyphsRec {
-
- gxFont theFont; /* ---> Font reference */
- long nGlyphs; /* ---> Number of glyphs in the font */
- gxFontPlatform platform; /* <--- How printer font is encoded, gxGlyphPlatform unless font is not 8-bit reencodable such as Kanji fonts
- in that case put the gxJapaneseFontPlatform, for exampe */
- gxFontScript script; /* <--- Script if platform != glyphPlatform */
- gxFontLanguage language; /* <--- Language if platform != glyphPlatform */
- long vmUsage; /* <--- How much PostScript VM font uses */
-
- /* Size of this array is long-alligned(nGlyphs) */
- unsigned long glyphBits[1]; /* <--- Bit array of which system glyphs are in printer */
-
- };
- typedef struct gxPrinterGlyphsRec gxPrinterGlyphsRec;
-
-
- /* PostScript device rendering information */
- enum {
- gxNeedsHexOption = 0x00000001, /* Convert all binary data to hex */
- gxNeedsCommentsOption = 0x00000002, /* Issue PostScript comments */
- gxBoundingBoxesOption = 0x00000004, /* Calculate the values for */
- gxPortablePostScriptOption = 0x00000008, /* Generate portable PostScript */
- gxTextClipsToPathOption = 0x00000010, /* Convert all clips that are composed of text to path shapes */
-
- /* Note, these two were never implemented, going way, way back, but I'll leave them in the enum anyway */
- gxFlattenClipPathOption = 0x00000020, /* Convert all clips that are path shapes to polygons (helps better control point limit) */
- gxUseCharpath1Option = 0x00000040, /* (ignored if text clips are converted to paths) When the clip is text, */
- /* Do it one glyph at a time, redrawing the main shape each time */
-
- gxUseLevel2ColorOption = 0x00000080, /* When printing to level-2 use level-2 device independent color */
-
- gxNoEPSIllegalOperators = 0x00000100, /* Don't use any operators prohibited by the Encapsulated PostScript File Format V3.0 */
- gxPageIndependentPostScript = 0x00000200, /* Don't generate PostScript with page interdependencies */
-
- /* PostScript intended for EPS Use. */
- gxEPSTargetOption = gxPageIndependentPostScript +
- gxNoEPSIllegalOperators +
- gxNeedsCommentsOption +
- gxBoundingBoxesOption,
- };
-
- typedef long gxPostScriptRenderOptions;
-
- struct gxPostScriptImageDataRec {
- short languageLevel; /* PostScript language level */
- gxColorSpace devCSpace; /* The printer's color space */
- gxColorProfile devCProfile; /* The printer's color profile for matching */
- gxPostScriptRenderOptions renderOptions; /* Options for the imaging system */
- long pathLimit; /* Maximum path size */
- short gsaveLimit; /* Maximum number of gsaves allowed */
- short opStackLimit; /* Operand stack limit */
- scalerStreamTypeFlag fontType; /* These are the font types that the printer supports */
- long printerVM; /* How much memory is in the printer */
- long reserved0;
- };
- typedef struct gxPostScriptImageDataRec gxPostScriptImageDataRec;
-
-
-
-
- typedef gxPostScriptImageDataRec * gxPostScriptImageDataPtr;
-
-
- struct gxFormatHalftoneInfo {
- long numHalftones; /* Number of halftone records */
- gxHalftone halftones[1]; /* The halftone records */
- };
- typedef struct gxFormatHalftoneInfo gxFormatHalftoneInfo;
-
- enum {
- gxFormatHalftoneTag = FOUR_CHAR_CODE('half')
- };
-
- /************************************* NEW STUFF *********************************/
- /************************************* NEW STUFF *********************************/
- /************************************* NEW STUFF *********************************/
- /************************************* NEW STUFF *********************************/
- /************************************* NEW STUFF *********************************/
- /************************************* NEW STUFF *********************************/
- /************************************* NEW STUFF *********************************/
- /************************************* NEW STUFF *********************************/
- /************************************* NEW STUFF *********************************/
- /* VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV*/
- /******************** ABSTRACT CLASSES FOR INTERACTING WITH THE WORLD ********************/
-
- /*************
- This class is for accessing the spool file.
- The LaserWriter driver will have to subclass this
- appropriately.
-
- This is called by the font database handler during spooling to save the
- database in the spool file and during despooling to read it back.
-
- **************/
- class gxSpoolFile {
- public:
- gxSpoolFile() {};
- virtual ~gxSpoolFile() {};
- virtual OSErr DespoolResource(OSType type, short ID, Handle *h) {return noErr;};
- virtual OSErr SpoolResource(Handle h, OSType type, short ID) {return noErr;};
-
- };//gxSpoolFile
-
-
- /**************
- This class is used by the GX To PostScript library
- for doing I/O and other device specific functions.
-
- It is an abstract class which the client is responsible
- for subclassing to perform the specified operations.
-
- Messages can be overridden in the following manner:
-
- Idle: This message is sent by the system to give up time to other processes.
-
- ReportStatus: Various user messages are sent via this message.
-
- BufferData: All PostScript is streamed through this message. Typically, a client would take the
- data passed to this method and insert it into its asynchronous I/O buffers.
-
- StreamFont: This message is sent to download fonts. It is NOT NECESSARY for the client to override this method
- because the default implementation calls the OFA 1.0 calls in GXGraphics and takes the resulting
- data and pipes it through the object's BufferData message. However, it is overridable in case the client
- has some other way of streaming font data. NOT RECCOMENDED, HOWEVER!
-
- GetPrinterGlyphsInformation:
- This message is sent by the system to find out what glyphs of a font are available on the printer.
- The client can override this message and query the printer for the information, or it can query a PPD
- file for the information. Any glyphs not on the printer will be streamed (via the StreamFont message)
- The default implementation reports that no glyphs are available.
-
- GetPSProduct: This message is sent to find out the version/revision/product name of the printer.
- The default implementation just returns "*" for all three.
-
- ***************/
- class CGXtoPostScriptDevice {
-
- public:
- CGXtoPostScriptDevice() {};
- virtual ~CGXtoPostScriptDevice() {};
-
- virtual OSErr Idle() {return noErr;};
- virtual OSErr ReportStatus(long count, unsigned char message[]);
- virtual OSErr BufferData(char* data, long size, unsigned long flags) {return noErr;};
- virtual OSErr StreamFont(gxFont whatFont, scalerStream *streamRecord);
- virtual OSErr GetPrinterGlyphsInformation(gxPrinterGlyphsRec *printerGlyphs);
- virtual OSErr GetPSProduct(Str255 version, Str255 revision, Str255 product);
-
- };//CGXtoPostScriptDevice
-
-
- // This function is in the never shipped GXGraphics 1.2, so for our purposes we'll just return nil,
- // The imaging engine code handles a nil result already, and uses ColorSync 1.0 stuff in this case.
- // If the client would like this translator to use ColorSync 2.x to generate PostScript color space arrays
- // and CRD's rather than using the built in code based on ColorSync 1.x, then the client could
- // tag the GX color profile object with a 2.0 profile and this routine could be rewritten
- // to return the appropriate 2.0 profile. (or a global profile could be returned in one is
- // managed by the driver.
- inline CMProfileRef GXGetColorProfileReference(gxColorProfile source) {return nil;};
-
-
-
-
- #endif
-